home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / compress / shaid220.zip / ACVT.BTM next >
Text File  |  1997-04-30  |  4KB  |  189 lines

  1. @ECHO OFF
  2.  
  3. IF %2 NE ARJ .AND. %2 NE ZIP .AND. %2 NE RAR .AND. %2 NE LHA .AND. %2 NE UC2 .AND. %2 NE RKV .AND. %2 NE JAR GOTO HELP
  4.  
  5. FOR %a in (%1) do GOSUB PROCESS
  6. GOTO END
  7.  
  8. :PROCESS
  9. echos %a
  10. archid %a >nul
  11.  
  12. if errorlevel 255 goto NOT_RECOGNIZED
  13. if errorlevel 249 goto OTHER_ERROR
  14. if errorlevel 107 goto NON_SUPPORTED
  15. if errorlevel eq 106 set df=LHA
  16. if errorlevel eq 105 set df=LHA
  17. if errorlevel eq 104 set df=RAR
  18. if errorlevel eq 103 set df=ZIP
  19. if errorlevel eq 102 set df=ZIP
  20. if errorlevel eq 101 set df=ARJ
  21. if errorlevel eq 41 set df=JAR
  22. if errorlevel eq 40 set df=RKV
  23. if errorlevel eq 6 set df=UC2
  24. if errorlevel eq 5 set df=LHA
  25. if errorlevel eq 4 set df=LHA
  26. if errorlevel eq 3 set df=RAR
  27. if errorlevel eq 2 set df=ZIP
  28. if errorlevel eq 1 set df=ARJ
  29. if df=="" goto NON_SUPPORTED
  30.  
  31. set fn=%@name[%a].%2
  32. if exist %fn% goto ALREADY_EXISTS
  33. echos ` to `%fn%...
  34. MD $A
  35. echos ` un-`%df%...
  36. gosub %df%_U
  37. cd $A
  38. echos ` `%2 comp...
  39. gosub %2_P
  40. gosub CLEAN
  41. echo ` (`%@filesize[%a] to %@filesize[%fn%] bytes)
  42. unset fn
  43. unset df
  44. IF "%3"=="/D" GOSUB DEL_OPTION
  45. IF "%3"=="/S" GOSUB SMALLEST
  46. RETURN
  47.  
  48. :CLEAN
  49. cd ..
  50. del /q /s /x /z /y $A
  51. RETURN
  52.  
  53. :DEL_OPTION
  54. echo Deleting original file %a
  55. DEL %a /Q
  56. RETURN
  57.  
  58. :SMALLEST
  59. IF %@filesize[%a%] GE %@filesize[%fn%] set delfile=%a%
  60. IF %@filesize[%fn%] GT %@filesize[%a%] set delfile=%fn%
  61. echo Deleting larger file %delfile%
  62. del %delfile% /Q
  63. unset delfile
  64. RETURN
  65.  
  66. :ZIP_U
  67. PKUNZIP -D %a $A >NUL
  68. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  69. RETURN
  70.  
  71. :ARJ_U
  72. ARJ X %a $A\ >NUL
  73. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  74. RETURN
  75.  
  76. :RAR_U
  77. RAR X -std %a $A\ >NUL
  78. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  79. RETURN
  80.  
  81. :LHA_U
  82. LHA X %a $A\ >NUL
  83. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  84. RETURN
  85.  
  86. :UC2_U
  87. UC E -S %a #$A >NUL
  88. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  89. RETURN
  90.  
  91. :RKV_U
  92. cd $A
  93. rkive -x ..\%a >NUL
  94. cd ..
  95. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  96. RETURN
  97.  
  98. :JAR_U
  99. jar16 x %a $A\ >NUL
  100. IF ERRORLEVEL 1 GOTO UNPACK_ERROR
  101. RETURN
  102.  
  103. :ZIP_P
  104. pkzip -rP -ex ..\%fn% >NUL
  105. IF ERRORLEVEL 1 GOTO PACK_ERROR
  106. RETURN
  107.  
  108. :ARJ_P
  109. arj a -r -m1 -jm ..\%fn% >NUL
  110. IF ERRORLEVEL 1 GOTO PACK_ERROR
  111. RETURN
  112.  
  113. :RAR_P
  114. rar a -m5 -s -r -std ..\%fn% >NUL
  115. IF ERRORLEVEL 1 GOTO PACK_ERROR
  116. RETURN
  117.  
  118. :UC2_P
  119. uc a -s ..\%fn% >NUL
  120. IF ERRORLEVEL 1 GOTO PACK_ERROR
  121. RETURN
  122.  
  123. :LHA_P
  124. lha a -r ..\%fn% >NUL
  125. IF ERRORLEVEL 1 GOTO PACK_ERROR
  126. RETURN
  127.  
  128. :RKV_P
  129. rkive -c -mtx -o+ -r -pr ..\%fn% *.* >NUL
  130. IF ERRORLEVEL 1 GOTO PACK_ERROR
  131. RETURN
  132.  
  133. :JAR_P
  134. jar16 a -r -m4 ..\%fn% >NUL
  135. IF ERRORLEVEL 1 GOTO PACK_ERROR
  136. RETURN
  137.  
  138. :UNPACK_ERROR
  139. echo Error uncompressing %a.
  140. unset fn
  141. unset df
  142. GOSUB CLEAN
  143. GOTO END
  144.  
  145. :PACK_ERROR
  146. echo Error compressing %fn%.
  147. unset fn
  148. unset df
  149. GOSUB CLEAN
  150. GOTO END
  151.  
  152. :ALREADY_EXISTS
  153. echo Destination file (%fn%) already exists.
  154. unset fn
  155. unset df
  156. RETURN
  157.  
  158. :NOT_RECOGNIZED
  159. echo %a not recognized as an archive!
  160. GOTO END
  161.  
  162. :OTHER_ERROR
  163. echo SH Archive Identifier terminated with an error.
  164. GOTO END
  165.  
  166. :NON_SUPPORTED
  167. echo ARCHID recognized %a but this batch file does not support this format.
  168. GOTO END
  169.  
  170. :HELP
  171. echo.
  172. echo Archive Conversion BTM for SH Archive Identifier 2.10 [10 Feb 97]
  173. echo.
  174. echo Converts archives from ARJ, PKZIP, RAR, LHA (+LHarc), UC2, RKIVE, JAR, and
  175. echo ARJ SFX, PKZIP SFX (+SFXjr), RAR SFX, LHA SFX (+LHarc SFX) format to
  176. echo ARJ, PKZIP, RAR, LHA, UC2, RKIVE, or JAR format (non-SFX).
  177. echo.
  178. echo Usage: ACVT filespec ARJ.ZIP.RAR.LHA.UC2 [/D]
  179. echo   (arg.1) filespec -- files to convert, wildcards ok
  180. echo   (arg.2) arc.type -- destination format, only one allowed
  181. echo   (arg.3) options  -- optional /D or /S (see below)
  182. echo.
  183. echo Options:
  184. echo   /D -- Delete original file(s)
  185. echo   /S -- leave only Smallest archive file(s)
  186.  
  187. :END
  188. CANCEL 0
  189.